Class Hand

java.lang.Object
  extended by Hand

public class Hand
extends java.lang.Object

Hand models a hand of cards held by a player.

Version:
1.1 October 11, 2012 Aly Moursy 100910299, May 24, 2016
Author:
Lynn Marshall

Constructor Summary
Hand()
          Constructs a new, empty hand.
 
Method Summary
 void addCard(Card aCard)
          Adds the specified card to this hand.
 boolean isEmpty()
          Determines if this hand is empty.
 Card playCard()
          Removes a card from this hand.
 int size()
          Returns the number of cards that are currently in this hand.
 java.lang.String toString()
          Returns a String that lists the ranks (but not the suits) of all the cards in this hand, starting with the first card and finishing with the last card.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Hand

public Hand()
Constructs a new, empty hand.

Method Detail

addCard

public void addCard(Card aCard)
Adds the specified card to this hand.

Parameters:
a - specified card to be added;

isEmpty

public boolean isEmpty()
Determines if this hand is empty.

Returns:
true if no objects in the list

playCard

public Card playCard()
Removes a card from this hand. Cards are removed in the order in which they were added to the hand.

Returns:
removed card from hand

size

public int size()
Returns the number of cards that are currently in this hand.

Returns:
the number of cards that are currently in this hand.

toString

public java.lang.String toString()
Returns a String that lists the ranks (but not the suits) of all the cards in this hand, starting with the first card and finishing with the last card. For example, if the first card is the two of hearts, the second card is the five of diamonds, and the last card is the queen of clubs, the String returned by this method will be: "2 5 12".

Overrides:
toString in class java.lang.Object
Returns:
the string output